<?php
/**
 * Created by JetBrains PhpStorm.
 * User: jun
 * Date: 14-3-21
 * Time: 上午2:04
 * To change this template use File | Settings | File Templates.
 */
include_once( "../common/dbConn.php");
//获取数据库连接
$db = connectDatabase();
class crud{
    public function dbSelect($arg_sql){
        try{
            global $db;
            $rs_cursor = $db->query($arg_sql);
            $rs_cursor->setFetchMode(PDO::FETCH_ASSOC);
            $rs = $rs_cursor->fetchAll();
            return $rs;
        }catch (Exception $e){
            throw new Exception($e->getMessage());
        }
    }

    public  function dbExec($arg_sql){
        try{
            $msg = "success";
            global $db;
            $temp = $db->exec($arg_sql);
            if(!$temp){
                $msg = "error" ;
            }
            return $msg;
        }catch (Exception $e){
            throw new Exception($e->getMessage());
        }

    }

}